package org.cashbook.utilities;

import org.cashbook.core.objects.transaction.ITransactionOverview;
import org.cashbook.utilities.logger.ILogger;
import org.cashbook.utilities.logger.LoggerTXT;

public class UtilitiesFactory {
	private static ILogger logger;
	
	public static ILogger getLogger() {
		if(logger == null)
			logger = new LoggerTXT(ILogger.FINEST);
//			logger = new LoggerCMD(ILogger.INFO);
		
		return logger;
	}
	
	public static String convertMonthToStr(int nr) {
		switch(nr) {
			case 0: return ITransactionOverview.JANUARY;
			case 1: return ITransactionOverview.FEBRUARY;
			case 2: return ITransactionOverview.MARCH;
			case 3: return ITransactionOverview.APRIL;
			case 4: return ITransactionOverview.MAY;
			case 5: return ITransactionOverview.JUNE;
			case 6: return ITransactionOverview.JULY;
			case 7: return ITransactionOverview.AUGUST;
			case 8: return ITransactionOverview.SEPTEMBER;
			case 9: return ITransactionOverview.OCTOBER;
			case 10: return ITransactionOverview.NOVEMBER;
			default: return ITransactionOverview.DECEMBER;
		}
	}
	
	public static int convertMonthToInt(String month) {
		if(month.equals(ITransactionOverview.JANUARY))
			return 0;
		else if(month.equals(ITransactionOverview.FEBRUARY))
			return 1;
		else if(month.equals(ITransactionOverview.MARCH))
			return 2;
		else if(month.equals(ITransactionOverview.APRIL))
			return 3;
		else if(month.equals(ITransactionOverview.MAY))
			return 4;
		else if(month.equals(ITransactionOverview.JUNE))
			return 5;
		else if(month.equals(ITransactionOverview.JULY))
			return 6;
		else if(month.equals(ITransactionOverview.AUGUST))
			return 7;
		else if(month.equals(ITransactionOverview.SEPTEMBER))
			return 8;
		else if(month.equals(ITransactionOverview.OCTOBER))
			return 9;
		else if(month.equals(ITransactionOverview.NOVEMBER))
			return 10;
		else
			return 11;
	}

}
;